var helper = require("./helper");
var SmtpServer = require("./SmtpServer");

// wrapper function allows for easy debugging (using return)
(function main() {

    // eases development process
    helper.exitOnKeyPress();

    var port = 25;
    var smtp = new SmtpServer(port);
    console.log("SMTP server is listening on port " + port);

    smtp.onClientConnected = function () {
        console.log('client connected');
    }
    smtp.onClientDisconnected = function () {
        console.log('client disconnected');
    }
    smtp.onDataReceived = function (data) {
        console.log('data received: ', data.toString())
        // TODO: write message to store
    }

}())